
//
//  ImageGalleryTableViewCell.m
//  PictureYourself
//
//  Created by Daniel on 28/7/12.
//
//

#import "PYImageGalleryTableViewCell.h"

@implementation PYImageGalleryTableViewCell

@synthesize index=index_;

-(void)awakeFromNib
{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    image1_.delegate =
    image2_.delegate =
    image3_.delegate =
    image4_.delegate =
        self;
    
    image1_.index = 0;
    image2_.index = 1;
    image3_.index = 2;
    image4_.index = 3;
}

-(void)thumbnailImageViewWasSelected:(PYImageGalleryImageView *)thumbnail_image_view atIndex:(NSUInteger)image_index
{
    if(!self.delegate)
        return;
    
    [self.delegate thumbnailCellImageWasSelected:self :image_index];
}

-(void)thumbnailImageViewWasDeSelected:(PYImageGalleryImageView *)thumbnailImageView atIndex:(NSUInteger)image_index
{
    if(!self.delegate)
        return;
    
    [self.delegate thumbnailCellImageWasDeSelected:self :image_index];
}

-(void)setSelectionForImage:(NSUInteger)image_index selection:(BOOL)on animated:(BOOL)animated
{
    switch (image_index)
    {
        case 0:
            [image1_ setSelection:on :animated];
            break;

        case 1:
            [image2_ setSelection:on :animated];
            break;
        
        case 2:
            [image3_ setSelection:on :animated];
            break;
        
        case 3:
            [image4_ setSelection:on :animated];
            break;
        
        default:
            break;
    }
}


-(void)dealloc
{
    [super dealloc];
    NSLog(@"Cell was dealloced\n");
}

@end
